package com.player.thirdGroup.dao;

import com.player.thirdGroup.entity.Menu;
import com.player.thirdGroup.entity.Player;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author VULCAN
 * @create 2019-12-27 21:29
 * @desc 账号
 **/
public interface MenuDao extends JpaRepository<Menu, String> {
    @Query(value = "select * from sys_menu",nativeQuery = true)
    public List<Menu> lists();

    @Query(value = "select DISTINCT m.* from sys_user u,sys_role_user ru ,sys_menu_role mr ,sys_menu m where u.user_id = ru.user_id and ru.role_id = mr.role_id and mr.menu_id = m.id and u.user_id = ?1" ,nativeQuery = true)
    public List<Menu> rolemenu(String userid);
}
